﻿using Learun.Util;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-01 15:08
    /// 描 述：数据字典
    /// </summary>
    public interface ec_dataitemIBLL
    {
        #region 获取数据
        /// <summary>
        /// 获取页面显示列表数据
        /// <summary>
        /// <param name="queryJson">查询参数</param>
        /// <param name="isEnabled">是否只取有效</param>
        /// <returns></returns>
        IEnumerable<ec_dataitemEntity> GetList(string queryJson, bool isEnabled = true, Pagination pagination = null);

        /// <summary>
        /// 获取实体数据
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        ec_dataitemEntity GetEntity(string keyValue, string projectId);
        /// <summary>
        /// 获取分类树形数据
        /// </summary>
        /// <returns></returns>
        List<TreeModel> GetClassifyTree(string projectId);
        /// <summary>
        /// 判断分类编号是否重复
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="dataItemCode">编码</param>
        /// <returns></returns>
        bool ExistItemCode(string keyValue, string dataItemCode, string projectId);
        /// <summary>
        /// 判断分类名称是否重复
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="dataItemName">名称</param>
        /// <returns></returns>
        bool ExistItemName(string keyValue, string dataItemName, string projectId);
        #endregion

        #region 提交数据

        /// <summary>
        /// 删除实体数据
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        void DeleteEntity(string keyValue, string projectId);
        /// <summary>
        /// 保存实体数据（新增、修改）
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        void SaveEntity(string keyValue, ec_dataitemEntity entity, string projectId);
        /// <summary>
        /// 导入S3D的PART NUBMER数据
        /// </summary>
        /// <param name="strPartNumberItemUID">PART NUBMER的DATAITEM表中的ID值</param>
        /// <param name="strExcelFilePath">EXCEL的路径</param>
        /// <param name="projectId">项目ID</param>
        void PartNumberDetailImport(string strPartNumberItemUID, string strExcelFilePath, string projectId);
        #endregion


        #region 字典明细

        /// <summary>
        /// 获取数据字典明细
        /// </summary>
        /// <param name="dataItemCode">分类编码</param>
        /// <param name="keyword">关键词（名称/值）</param>
        /// <param name="isAll">是否包含无效数据</param>
        /// <returns></returns>
        List<ec_dataitemdetailEntity> GetDetailList(string dataItemCode, string keyword, string projectId, bool isAll = true);

        /// <summary>
        /// 获取数据字典明显树形数据
        /// </summary>
        /// <param name="itemCode">分类编号</param>
        /// <returns></returns>
        List<TreeModel> GetDetailTree(string dataItemCode, string projectId);

        /// <summary>
        /// 字典明细编号不能重复
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="dataItemCode">字典明细编号</param>
        /// <param name="itemCode">分类编码</param>
        /// <returns></returns>
        bool ExistDetailItemCode(string keyValue, string dataItemCode, string itemCode, string projectId);

        /// <summary>
        /// 字典明细名称不能重复
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="dataItemName">字典明细名称</param>
        /// <param name="itemCode">分类编码</param>
        /// <returns></returns>
        bool ExistDetailItemName(string keyValue, string dataItemName, string itemCode, string projectId);

        /// <summary>
        /// 保存明细数据实体
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="entity">实体</param>
        string SaveDetailEntity(string keyValue, ec_dataitemdetailEntity entity, string projectId);

        /// <summary>
        /// 删除明细数据
        /// </summary>
        /// <param name="keyValue">主键</param>
        void DeleteDetail(string keyValue, string projectId);

        #endregion
    }
}
